package cn.ffcs.uec.recordsApproval.component;


import java.util.ArrayList;
import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.zkoss.zk.ui.Components;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.IdSpace;
import org.zkoss.zul.Div;


import cn.ffcs.uec.recordsApproval.component.bean.StaffEntryApprovalViewExtBean;
import cn.ffcs.uom.common.util.ListboxUtils;
import cn.ffcs.uom.common.vo.NodeVo;
import lombok.Getter;

@Controller
@Scope("prototype")
public class StaffEntryApprovalViewExt extends Div implements IdSpace {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5179281318446091643L;
	
	@Getter
	private StaffEntryApprovalViewExtBean bean = new StaffEntryApprovalViewExtBean();
	
	public static final String STAFF_ENTRY_APPROVAL_VIEW_EXT_ZUL = "/pages_nmg/recordsApproval/comp/staffEntry_approval_view_ext.zul";
	/**
	 * 构造函数
	 */
	public StaffEntryApprovalViewExt() {
		Executions.createComponents(STAFF_ENTRY_APPROVAL_VIEW_EXT_ZUL, this, null);
		Components.wireVariables(this, bean);
		Components.addForwards(this, this, '$');
		
	}

	/**
	 * 初始化
	 */
	public void onCreate() {
		this.bindCombobox();
		
		
	}
	
	/**
	 * 绑定下拉框 绑定combobox
	 */
	private void bindCombobox() {
		// 绑定证件类型
		 List<NodeVo> nodeVoIdTypeList = new ArrayList<NodeVo>();
		 String[][] idType = {{"0", "身份证"}};
		 for (int i = 0; i < idType.length; i++) {
		 NodeVo nodeVo = new NodeVo();
		 for (int j = 0; j < 1; j++) {
		 nodeVo.setId(idType[i][j]);
		 nodeVo.setName(idType[i][j + 1]);
		 }
		 nodeVoIdTypeList.add(nodeVo);
		 }
		 ListboxUtils.rendererForEdit(bean.getIdtype(), nodeVoIdTypeList);

		// 绑定性别sex:
		List<NodeVo> nodeVoSexList = new ArrayList<NodeVo>();
		String[][] sex = { { "1", "男" }, { "2", "女" } };
		for (int i = 0; i < sex.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(sex[i][j]);
				nodeVo.setName(sex[i][j + 1]);
			}
			nodeVoSexList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getSex(), nodeVoSexList);

		// 绑定民族nationality
		List<NodeVo> nodeVoNationalityList = new ArrayList<NodeVo>();
		String[][] nationality = { { "1001A11000000000063W", "汉族" }, { "1001A110000000000647", "侗族" },
				{ "1001A11000000000063Y", "回族" }, { "1001A110000000000646", "满族" }, { "1001A11000000000063X", "蒙古族" } };
		for (int i = 0; i < nationality.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(nationality[i][j]);
				nodeVo.setName(nationality[i][j + 1]);
			}
			nodeVoNationalityList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getNationality(), nodeVoNationalityList);

		// 婚姻状况marital
		List<NodeVo> nodeVoMaritalList = new ArrayList<NodeVo>();
		String[][] marital = { { "1001A1100000000005XQ", "未婚" }, { "1001A1100000000005XR", "已婚" },
				{ "1001A1100000000005XS", "再婚" }, { "1001A1100000000005XT", "离异" }, { "1001A1100000000005XU", "丧偶" } };
		for (int i = 0; i < marital.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(marital[i][j]);
				nodeVo.setName(marital[i][j + 1]);
			}
			nodeVoMaritalList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getMarital(), nodeVoMaritalList);

		// 健康状况
		List<NodeVo> nodeVoHealthList = new ArrayList<NodeVo>();
		String[][] health = { { "1001A1100000000005YD", "健康" }, { "1001A1100000000005YE", "一般" },
				{ "1001A1100000000005YF", "有慢性病" }, { "1001A1100000000005YG", "有生理缺陷" },
				{ "1001A1100000000005YH", "残疾" }, { "1001A1100000000005YI", "较差" } };
		for (int i = 0; i < health.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(health[i][j]);
				nodeVo.setName(health[i][j + 1]);
			}
			nodeVoHealthList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getHealth(), nodeVoHealthList);

		// 政治面貌
		List<NodeVo> nodeVoPolityList = new ArrayList<NodeVo>();
		String[][] polity = { { "1001A1100000000006D6", "中国共产党党员" }, { "1001A1100000000006D7", "中国共产党预备党员" },
				{ "1001A1100000000006D8", "中国共产主义青年团团员" }, { "1001A1100000000006DI", "群众" } };
		for (int i = 0; i < polity.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(polity[i][j]);
				nodeVo.setName(polity[i][j + 1]);
			}
			nodeVoPolityList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getPolity(), nodeVoPolityList);

		// 学历edu
		List<NodeVo> nodeVoEduList = new ArrayList<NodeVo>();
		String[][] edu = { { "1001A1100000000006AN", "硕士研究生" }, { "1001A1100000000006AO", "研究生同等学历" },
				{ "1001A1100000000006AP", "大学本科" }, { "1001A1100000000006AQ", "专科" }, { "1001A1100000000006AR", "中专" },
				{ "1001A1100000000006AS", "高中" }, { "1001A1100000000006AT", "技工学校" }, { "1001A1100000000006AU", "初中" },
				{ "1001A1100000000006AV", "小学" }, { "1001A1100000000006AW", "无" },
				{ "1001A1100000000006AX", "大学普通班" } };
		for (int i = 0; i < edu.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(edu[i][j]);
				nodeVo.setName(edu[i][j + 1]);
			}
			nodeVoEduList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getEdu(), nodeVoEduList);

		// 学位pkDegree
		List<NodeVo> nodeVoPkDegreeList = new ArrayList<NodeVo>();
		String[][] pkDegree = { { "1001A1100000000006AY", "博士" }, { "1001A1100000000006AZ", "双硕士" },
				{ "1001A1100000000006B0", "硕士" }, { "1001A1100000000006B1", "双学士" }, { "1001A1100000000006B2", "学士" },
				{ "1001A1100000000006B3", "无" } };
		for (int i = 0; i < pkDegree.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(pkDegree[i][j]);
				nodeVo.setName(pkDegree[i][j + 1]);
			}
			nodeVoPkDegreeList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getPkDegree(), nodeVoPkDegreeList);

		// 户口性质characterrpr
		List<NodeVo> nodeVoCharacterrprList = new ArrayList<NodeVo>();
		String[][] characterrpr = { { "1001A1100000000005XM", "城镇" }, { "1001A1100000000005XN", "农村" } };
		for (int i = 0; i < characterrpr.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(characterrpr[i][j]);
				nodeVo.setName(characterrpr[i][j + 1]);
			}
			nodeVoCharacterrprList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getCharacterrpr(), nodeVoCharacterrprList);

		// 是否是历史成员
		List<NodeVo> nodeVoIshiskeypsnList = new ArrayList<NodeVo>();
		String[][] ishiskeypsn = { { "Y", "是" }, { "N", "否" } };
		for (int i = 0; i < ishiskeypsn.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(ishiskeypsn[i][j]);
				nodeVo.setName(ishiskeypsn[i][j + 1]);
			}
			nodeVoIshiskeypsnList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getIshiskeypsn(), nodeVoIshiskeypsnList);
		// 是否是门店营业员
		ListboxUtils.rendererForEdit(bean.getIsshopassist(), nodeVoIshiskeypsnList);
		// 是否承包经营个人
		ListboxUtils.rendererForEdit(bean.getGlbdef14(), nodeVoIshiskeypsnList);

	}
	
	
	

}
